<%@ page import="com.bdqn.service.NewsService" %>
<%@ page import="com.bdqn.service.Impl.NewsServiceImpl" %>
<%@ page import="com.bdqn.entity.News" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/2/23
  Time: 17:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新闻列表页</title>
</head>
<body>
<%--通过jsp:useBean动作标签创建对象--%>
<jsp:useBean id="newsService" class="com.bdqn.service.Impl.NewsServiceImpl"></jsp:useBean>
<%
    //在jsp页面中显示全部的新闻信息
    //创建新闻实现类对象
    //NewsService newsService=new NewsServiceImp();
    List<News> newsList = newsService.queryNewsAll();
%>
<table>
    <tr>
        <th>新闻编号</th>
        <th>新闻分类</th>
        <th>新闻标题</th>
        <th>新闻摘要</th>
        <th>新闻内容</th>
        <th>新闻图片</th>
        <th>新闻作者</th>
        <th>创建日期</th>
        <th>修改日期</th>
    </tr>
    <%
        //用增强型for循环遍历集合
        for (News news:newsList){
    %>
    <tr>
        <td><%=news.getId()%>></td>
        <td><%=news.getCategoryId()%>></td>
        <td><%=news.getTitle()%>></td>
        <td><%=news.getSummary()%>></td>
        <td><%=news.getContent()%>></td>
        <td><%=news.getPicPath()%>></td>
        <td><%=news.getAuthor()%>></td>
        <td><%=news.getCreateDate()%>></td>
        <td><%=news.getModifyDate()%>></td>
    </tr>
    <%
        }
    %>

</table>
<jsp:include page="test.jsp"></jsp:include>
</body>
</html>
